<?php

namespace App\ApiFrontend\User;

use App\Domains\AdminDomain;
use App\Http\Controllers\ApiBaseController;

/**
 *  用户信息
 */
class Info extends ApiBaseController
{

  /**
   * 参数检查
   */
  protected function check(): void
  {
  }

  /**
   * 业务主体
   */
  protected function service(): void
  {
    $userId = \request()->user()->userId;
    $moudle = \request()->get('module');
    //数据
    try {
      $field = ["username", "realname"];
      $userInfo = \DB::table('user as aa')
        ->join('exam_user as eu', "aa.userId", '=', "eu.userId")
        ->where('aa.userId', $userId)
        ->first($field);
      $this->result['data'] = $userInfo;

    } catch (\Exception $exception) {
      $this->result["code"] = 1;
      $this->result["message"] = "失败: " . $exception->getMessage();
    }
    return;
  }
}
